package com.test.wog.util;

import org.apache.logging.log4j.util.PropertiesUtil;
import org.springframework.stereotype.Component;

import java.io.InputStreamReader;
import java.util.Properties;

/**
 * 调用本地配置文件的工具
 *
 * @author LX
 * @since 2020-01-30
 */
@Component
public class PropertyUtil {
    public String getProjectConfig(String key) {
        Properties pros = new Properties();
        String value = "";
        try {
            pros.load(new InputStreamReader(PropertiesUtil.class.getResourceAsStream("/application.yml"), "UTF-8"));
            value = pros.getProperty(key);
            System.out.println(pros.keySet());
        } catch (Exception e) {
            return e.getMessage();
        }
        return value;
    }
}
